// import Layout from '@/components/layout/index.vue';
import Care from '@/views/care/index.vue';
import { type RouteRecordRaw, createRouter, createWebHistory } from 'vue-router';

const Layout = () => import('@/components/layout/index.vue');

export const routes: readonly RouteRecordRaw[] = [
	{
		path: '/',
		component: Layout,
		redirect: '/home',
		meta: {
			icon: 'home',
			title: '首页',
			key: 'home',
		},
		children: [
			{
				path: '/home',
				meta: {
					title: '首页',
					icon: 'home',
					key: 'home',
				},
				component: () => import('@/views/home/index.vue'),
			},
		],
	},
	{
		path: '/personnel/old/list',
		meta: {
			title: '入住长者',
			icon: 'home',
			key: 'personnel-old',
		},
		component: Layout,
		redirect: '/personnel/old',
		children: [
			{
				path: '/personnel/old',
				meta: {
					title: '入住长者',
					icon: 'home',
					key: 'personnel-old',
				},
				component: () => import('@/views/personnel-old/index.vue'),
			},
			{
				path: '/personnel/old/add',
				meta: {
					title: '新增',
					icon: 'home',
					key: 'personnel-old',
					hidden: true,
					hasBack: true
				},
				component: () => import('@/views/personnel-old-add/index.vue'),
			},
			{
				path: '/personnel/old/detail/:id?',
				meta: {
					title: '详情',
					icon: 'home',
					key: 'personnel-old',
					hidden: true,
					hasBack: true
				},
				component: () => import('@/views/personnel-old-detail/index.vue'),
			},
		]
	},
	{
		path: '/care',
		component: Layout,
		meta: {
			icon: 'home',
			title: '服务管理',
			key: 'care',
		},
		children: [
			{
				path: '/care',
				meta: {
					title: '服务管理',
					icon: 'home',
					key: 'care',
				},
				// component: () => import('@/views/care/index.vue'),
				component: Care,
			},
			{
				path: '/care/add',
				meta: {
					title: '添加服务包',
					icon: 'home',
					key: 'care',
					hidden: true,
					hasBack: true
				},
				component: () => import('@/views/care/care-add.vue'),
			},
			{
				path: '/care/detail/:id?',
				meta: {
					title: '详情',
					icon: 'home',
					key: 'care',
					hidden: true,
					hasBack: true
				},
				component: () => import('@/views/care/care-detail.vue'),
			},
		],
	},
	{
		path: '/room',
		component: Layout,
		meta: {
			icon: 'home',
			title: '房间管理',
			key: 'room',
		},
		children: [
			{
				path: '/room',
				meta: {
					title: '房间管理',
					icon: 'home',
					key: 'room',
				},
				component: () => import('@/views/room/index.vue'),
			},
		],
	},
	{
		path: '/personnel/worker',
		component: Layout,
		meta: {
			title: '职工管理',
			icon: 'home',
			key: 'personnel-worker',
		},
		children: [
			{
				path: '/personnel/worker',
				meta: {
					title: '职工管理',
					icon: 'home',
					key: 'personnel-worker',
				},
				component: () => import('@/views/personnel-worker/index.vue'),
			},
			{
				path: '/personnel/worker/add',
				meta: {
					title: '新增',
					icon: 'home',
					key: 'personnel-worker',
					hasBack: true
				},
				component: () => import('@/views/personnel-worker-add/index.vue'),
			}
		]
	},
	// 不展示
	// {
	// 	path: '/scheduling',
	// 	component: Layout,
	// 	meta: {
	// 		icon: 'home',
	// 		title: '排班管理',
	// 		key: 'scheduling',
	// 		hidden: true
	// 	},
	// 	children: [
	// 		{
	// 			path: '/scheduling',
	// 			meta: {
	// 				title: '排班管理',
	// 				icon: 'home',
	// 				key: 'scheduling',
	// 			},
	// 			component: () => import('@/views/scheduling/index.vue'),
	// 		},
	// 	],
	// },
	// {
	// 	path: '/system',
	// 	component: Layout,
	// 	meta: {
	// 		icon: 'home',
	// 		title: '系统管理',
	// 		expand: true,
	// 		key: 'system',
	// 		hidden: true
	// 	},
	// 	children: [
	// 		{
	// 			path: '/system',
	// 			meta: {
	// 				title: '系统管理',
	// 				icon: 'home',
	// 				key: 'system-manage',
	// 				parentKey: 'system',
	// 			},
	// 			component: () => import('@/views/system/index.vue'),
	// 		},
	// 		{
	// 			path: '/account',
	// 			meta: {
	// 				title: '账号管理',
	// 				icon: 'home',
	// 				key: 'account',
	// 				parentKey: 'system',
	// 			},
	// 			component: () => import('@/views/account/index.vue'),
	// 		},
	// 	],
	// },
	{
		path: '/login',
		meta: {
			hidden: true,
		},
		component: () => import('@/views/login/index.vue'),
	},
	{
		path: '/:notFound(.*)',
		meta: {
			hidden: true,
		},
		component: () => import('@/views/404.vue'),
	},
];

const router = createRouter({
	history: createWebHistory(import.meta.env.BASE_URL), // guanghe
	// history: createWebHistory('/admin'), // guanghe
	routes,
});

export default router;
